import java.util.ArrayList;
import java.util.List;

public class BookShelf extends Book implements Aggregate{
    private List<Book> books;
    private int last;

    public BookShelf() {
        this.books = new ArrayList<Book>();
        last = 0;
    }

    public Book getBookAt(int index){
        return books.get(index);
    }

    public void appendBook(Book book){
        books.add(book);
        last++;
    }

    public int getLength(){
        return last;
    }

    public Iterator iterator() {
        return new BookShelfIterator(this);
    }
}
